The present disclosure relates generally to memory management, and more specifically, to tuning utilization and heap memory size for real-time garbage collection (GC).
Memory leakage, broadly defined, is the gradual loss of allocable memory due to the failure to de-allocate previously allocated, but no longer utilized memory. Typically, memory can be reserved for data having a brief lifespan. Once the lifespan has completed, the reserved memory ought to be returned to the pool of allocable memory so that the reserved memory can be used at a subsequent time as needed. Importantly, where memory leakage persists without remediation, ultimately not enough memory will remain to accommodate the needs of other processes.
Recognizing the importance of addressing the memory leakage problem, computer programming language theorists have developed the notion of garbage collection (GC). GC refers to the automated analysis of allocated memory to identify regions of allocated memory containing data which no longer are required for the operation of associated processes. In the context of object oriented programming languages such as the Java programming language, when objects residing in memory are no longer accessible within a corresponding application, the memory allocated to the no longer accessed object can be returned to the pool of allocable memory.
Real-time application development distinguishes itself from general-purpose application development by imposing time restrictions on parts of the runtime behavior. Such restrictions are typically placed on sections of the application such as an interrupt handler, where the code responding to the interrupt must complete its work in a given time period. When hard real-time systems that control, for example, heart monitors or defense systems, miss these deadlines it is considered a catastrophic failure of the entire system. This is contrasted with soft real-time systems where missed deadlines can have adverse effects, such as a graphic user interface (GUI) not displaying all results of a stream it is monitoring, but these adverse effects do not constitute a system failure.
In Java applications, the Java Virtual Machine (JVM) is responsible for optimizing runtime behavior, managing the object heap, and interfacing with the operating system and hardware. Although this management layer between the language and the platform eases software development, it introduces a certain amount of overhead into programs. One such area is GC, which typically causes non-deterministic pauses in the application. Both the frequency and length of the pauses are unpredictable, making the Java language traditionally unsuitable for real-time application development because real-time applications must respond to real-world stimuli within deterministic time intervals. A traditional GC can't meet this requirement because the application must halt for the GC to reclaim any unused memory. The time during which the application is halted is referred to as “pause time” because the application program is paused for the GC to reclaim free space.